<?php
namespace ImiDemo\HttpDemo\MainServer\Model;

use Imi\Model\Model;
use Imi\Model\Annotation\Table;
use Imi\Model\Annotation\Column;
use Imi\Model\Annotation\Entity;
use Imi\Model\Annotation\Relation\JoinTo;
use Imi\Model\Annotation\Relation\PolymorphicOneToOne;

/**
 * Team
 * @Entity
 * @Table(name="tb_team", id={"id"})
 * @property int $id
 * @property string $name
 * @property \ImiDemo\HttpDemo\MainServer\Model\Avatar $avatar
 */
class Team extends Model
{
    /**
     * id
     * @Column(name="id", type="int", length=10, accuracy=0, nullable=false, default="", isPrimaryKey=true, primaryKeyIndex=0, isAutoIncrement=true)
     * @var int
     */
    protected $id;

    /**
     * 获取 id
     *
     * @return int
     */ 
    public function getId()
    {
        return $this->id;
    }

    /**
     * 赋值 id
     * @param int $id id
     * @return static
     */ 
    public function setId($id)
    {
        $this->id = $id;
        return $this;
    }

    /**
     * name
     * @Column(name="name", type="varchar", length=32, accuracy=0, nullable=false, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false)
     * @var string
     */
    protected $name;

    /**
     * 获取 name
     *
     * @return string
     */ 
    public function getName()
    {
        return $this->name;
    }

    /**
     * 赋值 name
     * @param string $name name
     * @return static
     */ 
    public function setName($name)
    {
        $this->name = $name;
        return $this;
    }

    /**
     * 头像
     * 
     * @PolymorphicOneToOne(model=ImiDemo\HttpDemo\MainServer\Model\Avatar::class, type="type", typeValue=2)
     * @JoinTo("relation_id")
     *
     * @var \ImiDemo\HttpDemo\MainServer\Model\Avatar
     */
    protected $avatar;

    /**
     * Get 头像
     *
     * @return  \ImiDemo\HttpDemo\MainServer\Model\Avatar
     */ 
    public function getAvatar()
    {
        return $this->avatar;
    }

    /**
     * Set 头像
     *
     * @param  \ImiDemo\HttpDemo\MainServer\Model\Avatar  $avatar  头像
     *
     * @return  self
     */ 
    public function setAvatar(\ImiDemo\HttpDemo\MainServer\Model\Avatar $avatar)
    {
        $this->avatar = $avatar;

        return $this;
    }
    
}